home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 March / PC Answers CD-ROM 5 (Future Publishing) (March 1995).iso / public / experts / prog / math.bas < prev   
Encoding:
BASIC Source File  |  1994-11-30  |  1.0 KB  |  35 lines

  1. DECLARE SUB Division (Quotient$, Divisor$)
  2.  
  3. COLOR 15, 1
  4. CLS
  5. LOCATE 5, 5
  6. PRINT "x = ";
  7. Division "-b ± √b² - 4ac", "2 a"
  8.  
  9.  
  10. LOCATE 10, 9: PRINT "⌠∞";
  11. LOCATE 11, 5: PRINT "x = │ y² + 17yⁿ δy/δx";
  12. LOCATE 12, 8: PRINT "0⌡";
  13.  
  14. DEFINT A-Z
  15. '---------------------------------------------------------------------------
  16. '       Name:           Division
  17. '       Purpose:        Print one expression below another, with a division
  18. '                       bar between them.  Printing is at current cursor
  19. '                       position.  The expressions are centred w.r.t. bar.
  20. '---------------------------------------------------------------------------
  21. SUB Division (Quotient$, Divisor$)
  22.     d1 = LEN(Quotient$)
  23.     d2 = LEN(Divisor$)
  24.     d3 = d1
  25.     OldRow = CSRLIN
  26.     OldCol = POS(0)
  27.     IF d3 < d2 THEN d3 = d2
  28.     FOR i = 1 TO d1: PRINT CHR$(196); : NEXT
  29.     LOCATE OldRow - 1, OldCol + ((d3 - d1) \ 2)
  30.     PRINT Quotient$
  31.     LOCATE OldRow + 1, OldCol + ((d3 - d2) \ 2)
  32.     PRINT Divisor$
  33. END SUB
  34.  
  35.